﻿/******************************************************************************
 *  All Rights Reserved , Copyright (C) 2012 , EricHu. 
 *  作    者： EricHu
 *  创建时间： 2012-7-20 16:32:53
 ******************************************************************************/

using System;
using System.ComponentModel;
using System.Data;

namespace RDIFramework.BusinessEntity
{
  using RDIFramework.Utilities;

 /// <summary>
 /// PiModuleEntity
 /// 模块（菜单）表
 ///
 /// 修改纪录
 ///
 ///		2012-03-02 版本：1.0 EricHu 创建主键。
 ///
 /// 版本：1.0
 ///
 /// <author>
 ///		<name>EricHu</name>
 ///		<date>2012-03-02</date>
 /// </author>
 /// </summary>
    [Serializable]
    public partial class PiModuleEntity
    {
        private int? id = null;
        /// <summary>
        /// 主键
        /// </summary>
        public int? Id
        {
            get
            {
                return this.id;
            }
            set
            {
                this.id = value;
            }
        }

        private int? parentId = null;
        /// <summary>
        /// 父节点主键
        /// </summary>
        [DisplayName("ParentId")]
        public int? ParentId
        {
            get
            {
                return this.parentId;
            }
            set
            {
                this.parentId = value;
            }
        }

        private String code = string.Empty;
        /// <summary>
        /// 编号
        /// </summary>
        public String Code
        {
            get
            {
                return this.code;
            }
            set
            {
                this.code = value;
            }
        }

        private String fullName = string.Empty;
        /// <summary>
        /// 名称
        /// </summary>
        public String FullName
        {
            get
            {
                return this.fullName;
            }
            set
            {
                this.fullName = value;
            }
        }

        private String category = "Application";
        /// <summary>
        /// 菜单分类
        /// </summary>
        public String Category
        {
            get
            {
                return this.category;
            }
            set
            {
                this.category = value;
            }
        }

        private string moduleType = string.Empty;
        /// <summary>
        /// 模块类型
        /// </summary>
        public String ModuleType
        {
            get
            {
                return this.moduleType;
            }
            set
            {
                this.moduleType = value;
            }
        }

        private String imageIndex = string.Empty;
        /// <summary>
        /// 图标编号
        /// </summary>
        public String ImageIndex
        {
            get
            {
                return this.imageIndex;
            }
            set
            {
                this.imageIndex = value;
            }
        }

        private String selectedImageIndex = string.Empty;
        /// <summary>
        /// 选中状态图标编号
        /// </summary>
        public String SelectedImageIndex
        {
            get
            {
                return this.selectedImageIndex;
            }
            set
            {
                this.selectedImageIndex = value;
            }
        }

        private string iconCss = string.Empty;
        /// <summary>
        /// 一个CSS样式来显示一个16*16 的ICON（针对WebForm结构）
        /// </summary>
        public String IconCss
        {
            get { return this.iconCss; }
            set { this.iconCss = value; }
        }

        private string iconUrl = string.Empty;
        /// <summary>
        /// 图标地址（针对WebForm结构）
        /// </summary>
        public String IconUrl
        {
            get { return this.iconUrl; }
            set { this.iconUrl = value; }
        }

        private String navigateUrl = string.Empty;
        /// <summary>
        /// 导航地址
        /// </summary>
        public String NavigateUrl
        {
            get
            {
                return this.navigateUrl;
            }
            set
            {
                this.navigateUrl = value;
            }
        }

        private String target = string.Empty;
        /// <summary>
        /// 目标（针对WinForm结构）
        /// </summary>
        public String Target
        {
            get
            {
                return this.target;
            }
            set
            {
                this.target = value;
            }
        }

        private string formName = string.Empty;
        /// <summary>
        /// 窗体名称（针对WinForm结构）
        /// </summary>
        public String FormName
        {
            get
            {
                return this.formName;
            }
            set
            {
                this.formName = value;
            }
        }

        private string assemblyName = string.Empty;
        /// <summary>
        /// 程序集名称（针对WinForm结构）
        /// </summary>
        public String AssemblyName
        {
            get
            {
                return this.assemblyName;
            }
            set
            {
                this.assemblyName = value;
            }
        }

        private String permissionItemCode = "Resource.AccessPermission";
        /// <summary>
        /// 操作权限编号(数据权限范围)
        /// </summary>
        public String PermissionItemCode
        {
            get
            {
                return this.permissionItemCode;
            }
            set
            {
                this.permissionItemCode = value;
            }
        }

        private String permissionScopeTables = string.Empty;
        /// <summary>
        /// 需要数据权限过滤的表(,符号分割)
        /// </summary>
        public String PermissionScopeTables
        {
            get
            {
                return this.permissionScopeTables;
            }
            set
            {
                this.permissionScopeTables = value;
            }
        }

        private int? isPublic = 1;
        /// <summary>
        /// 是公开
        /// </summary>
        public int? IsPublic
        {
            get
            {
                return this.isPublic;
            }
            set
            {
                this.isPublic = value;
            }
        }

        private int? isMenu = 1;
        /// <summary>
        /// 是菜单
        /// </summary>
        public int? IsMenu
        {
            get
            {
                return this.isMenu;
            }
            set
            {
                this.isMenu = value;
            }
        }

        private int? expand = 0;
        /// <summary>
        /// 展开状态
        /// </summary>
        public int? Expand
        {
            get
            {
                return this.expand;
            }
            set
            {
                this.expand = value;
            }
        }

        private int? allowEdit = 1;
        /// <summary>
        /// 允许编辑
        /// </summary>
        public int? AllowEdit
        {
            get
            {
                return this.allowEdit;
            }
            set
            {
                this.allowEdit = value;
            }
        }

        private int? allowDelete = 1;
        /// <summary>
        /// 允许删除
        /// </summary>
        public int? AllowDelete
        {
            get
            {
                return this.allowDelete;
            }
            set
            {
                this.allowDelete = value;
            }
        }

        private int? sortCode = null;
        /// <summary>
        /// 排序码
        /// </summary>
        public int? SortCode
        {
            get
            {
                return this.sortCode;
            }
            set
            {
                this.sortCode = value;
            }
        }

        private int? deleteMark = 0;
        /// <summary>
        /// 删除标志
        /// </summary>
        public int? DeleteMark
        {
            get
            {
                return this.deleteMark;
            }
            set
            {
                this.deleteMark = value;
            }
        }

        private int? enabled = 1;
        /// <summary>
        /// 有效
        /// </summary>
        public int? Enabled
        {
            get
            {
                return this.enabled;
            }
            set
            {
                this.enabled = value;
            }
        }

        private String description = string.Empty;
        /// <summary>
        /// 描述
        /// </summary>
        public String Description
        {
            get
            {
                return this.description;
            }
            set
            {
                this.description = value;
            }
        }

        private DateTime? createOn = DateTime.Now;
        /// <summary>
        /// 创建日期
        /// </summary>
        public DateTime? CreateOn
        {
            get
            {
                return this.createOn;
            }
            set
            {
                this.createOn = value;
            }
        }

        private String createUserId = string.Empty;
        /// <summary>
        /// 创建用户主键
        /// </summary>
        public String CreateUserId
        {
            get
            {
                return this.createUserId;
            }
            set
            {
                this.createUserId = value;
            }
        }

        private String createBy = string.Empty;
        /// <summary>
        /// 创建用户
        /// </summary>
        public String CreateBy
        {
            get
            {
                return this.createBy;
            }
            set
            {
                this.createBy = value;
            }
        }

        private DateTime? modifiedOn = null;
        /// <summary>
        /// 修改日期
        /// </summary>
        public DateTime? ModifiedOn
        {
            get
            {
                return this.modifiedOn;
            }
            set
            {
                this.modifiedOn = value;
            }
        }

        private String modifyUserId = string.Empty;
        /// <summary>
        /// 修改用户主键
        /// </summary>
        public String ModifyUserId
        {
            get
            {
                return this.modifyUserId;
            }
            set
            {
                this.modifyUserId = value;
            }
        }

        private String modifiedBy = string.Empty;
        /// <summary>
        /// 修改用户
        /// </summary>
        public String ModifiedBy
        {
            get
            {
                return this.modifiedBy;
            }
            set
            {
                this.modifiedBy = value;
            }
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        public PiModuleEntity()
        {
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataRow">数据行</param>
        public PiModuleEntity(DataRow dataRow)
        {
            this.GetFrom(dataRow);
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataReader">数据流</param>
        public PiModuleEntity(IDataReader dataReader)
        {
            this.GetFrom(dataReader);
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataTable">数据表</param>
        public PiModuleEntity(DataTable dataTable)
        {
            this.GetFrom(dataTable);
        }

        /// <summary>
        /// 从数据表读取
        /// </summary>
        /// <param name="dataTable">数据表</param>
        public PiModuleEntity GetFrom(DataTable dataTable)
        {
            if ((dataTable == null) || (dataTable.Rows.Count == 0))
            {
                return null;
            }
            foreach (DataRow dataRow in dataTable.Rows)
            {
                this.GetFrom(dataRow);
                break;
            }
            return this;
        }

        /// <summary>
        /// 从数据行读取
        /// </summary>
        /// <param name="dataRow">数据行</param>
        public PiModuleEntity GetFrom(DataRow dataRow)
        {
            this.Id = BusinessLogic.ConvertToInt(dataRow[PiModuleTable.FieldId]);
            this.ParentId = BusinessLogic.ConvertToInt(dataRow[PiModuleTable.FieldParentId]);
            this.Code = BusinessLogic.ConvertToString(dataRow[PiModuleTable.FieldCode]);
            this.FullName = BusinessLogic.ConvertToString(dataRow[PiModuleTable.FieldFullName]);
            this.Category = BusinessLogic.ConvertToString(dataRow[PiModuleTable.FieldCategory]);
            this.ModuleType = BusinessLogic.ConvertToString(dataRow[PiModuleTable.FieldModuleType]);
            this.ImageIndex = BusinessLogic.ConvertToString(dataRow[PiModuleTable.FieldImageIndex]);
            this.SelectedImageIndex = BusinessLogic.ConvertToString(dataRow[PiModuleTable.FieldSelectedImageIndex]);
            this.NavigateUrl = BusinessLogic.ConvertToString(dataRow[PiModuleTable.FieldNavigateUrl]);
            this.Target = BusinessLogic.ConvertToString(dataRow[PiModuleTable.FieldTarget]);
            this.IconCss = BusinessLogic.ConvertToString(dataRow[PiModuleTable.FieldIconCss]);
            this.IconUrl = BusinessLogic.ConvertToString(dataRow[PiModuleTable.FieldIconUrl]);
            this.FormName = BusinessLogic.ConvertToString(dataRow[PiModuleTable.FiledFormName]);
            this.AssemblyName =  BusinessLogic.ConvertToString(dataRow[PiModuleTable.FiledAssemblyName]);
            this.PermissionItemCode = BusinessLogic.ConvertToString(dataRow[PiModuleTable.FieldPermissionItemCode]);
            this.PermissionScopeTables = BusinessLogic.ConvertToString(dataRow[PiModuleTable.FieldPermissionScopeTables]);
            this.IsPublic = BusinessLogic.ConvertToInt(dataRow[PiModuleTable.FieldIsPublic]);
            this.IsMenu = BusinessLogic.ConvertToInt(dataRow[PiModuleTable.FieldIsMenu]);
            this.Expand = BusinessLogic.ConvertToInt(dataRow[PiModuleTable.FieldExpand]);
            this.AllowEdit = BusinessLogic.ConvertToInt(dataRow[PiModuleTable.FieldAllowEdit]);
            this.AllowDelete = BusinessLogic.ConvertToInt(dataRow[PiModuleTable.FieldAllowDelete]);
            this.SortCode = BusinessLogic.ConvertToInt(dataRow[PiModuleTable.FieldSortCode]);
            this.DeleteMark = BusinessLogic.ConvertToInt(dataRow[PiModuleTable.FieldDeleteMark]);
            this.Enabled = BusinessLogic.ConvertToInt(dataRow[PiModuleTable.FieldEnabled]);          
            this.Description = BusinessLogic.ConvertToString(dataRow[PiModuleTable.FieldDescription]);
            this.CreateOn = BusinessLogic.ConvertToDateTime(dataRow[PiModuleTable.FieldCreateOn]);
            this.CreateUserId = BusinessLogic.ConvertToString(dataRow[PiModuleTable.FieldCreateUserId]);
            this.CreateBy = BusinessLogic.ConvertToString(dataRow[PiModuleTable.FieldCreateBy]);
            this.ModifiedOn = BusinessLogic.ConvertToDateTime(dataRow[PiModuleTable.FieldModifiedOn]);
            this.ModifyUserId = BusinessLogic.ConvertToString(dataRow[PiModuleTable.FieldModifyUserId]);
            this.ModifiedBy = BusinessLogic.ConvertToString(dataRow[PiModuleTable.FieldModifiedBy]);
            this.Enabled = this.Enabled == null ? 0 : this.Enabled;
            this.IsPublic = this.IsPublic == null ? 0 : this.IsPublic;
            this.IsMenu = this.IsMenu == null ? 0 : this.IsMenu;
            this.Expand = this.Expand == null ? 0 : this.Expand;
            return this;
        }

        /// <summary>
        /// 从数据流读取
        /// </summary>
        /// <param name="dataReader">数据流</param>
        public PiModuleEntity GetFrom(IDataReader dataReader)
        {
            this.Id = BusinessLogic.ConvertToInt(dataReader[PiModuleTable.FieldId]);
            this.ParentId = BusinessLogic.ConvertToInt(dataReader[PiModuleTable.FieldParentId]);
            this.Code = BusinessLogic.ConvertToString(dataReader[PiModuleTable.FieldCode]);
            this.FullName = BusinessLogic.ConvertToString(dataReader[PiModuleTable.FieldFullName]);
            this.Category = BusinessLogic.ConvertToString(dataReader[PiModuleTable.FieldCategory]);
            this.ModuleType = BusinessLogic.ConvertToString(dataReader[PiModuleTable.FieldModuleType]);
            this.ImageIndex = BusinessLogic.ConvertToString(dataReader[PiModuleTable.FieldImageIndex]);
            this.SelectedImageIndex = BusinessLogic.ConvertToString(dataReader[PiModuleTable.FieldSelectedImageIndex]);
            this.NavigateUrl = BusinessLogic.ConvertToString(dataReader[PiModuleTable.FieldNavigateUrl]);
            this.Target = BusinessLogic.ConvertToString(dataReader[PiModuleTable.FieldTarget]);
            this.IconCss = BusinessLogic.ConvertToString(dataReader[PiModuleTable.FieldIconCss]);
            this.IconUrl = BusinessLogic.ConvertToString(dataReader[PiModuleTable.FieldIconUrl]);
            this.FormName = BusinessLogic.ConvertToString(dataReader[PiModuleTable.FiledFormName]);
            this.AssemblyName = BusinessLogic.ConvertToString(dataReader[PiModuleTable.FiledAssemblyName]);
            this.PermissionItemCode = BusinessLogic.ConvertToString(dataReader[PiModuleTable.FieldPermissionItemCode]);
            this.PermissionScopeTables = BusinessLogic.ConvertToString(dataReader[PiModuleTable.FieldPermissionScopeTables]);
            this.IsPublic = BusinessLogic.ConvertToInt(dataReader[PiModuleTable.FieldIsPublic]);
            this.IsMenu = BusinessLogic.ConvertToInt(dataReader[PiModuleTable.FieldIsMenu]);
            this.Expand = BusinessLogic.ConvertToInt(dataReader[PiModuleTable.FieldExpand]);
            this.AllowEdit = BusinessLogic.ConvertToInt(dataReader[PiModuleTable.FieldAllowEdit]);
            this.AllowDelete = BusinessLogic.ConvertToInt(dataReader[PiModuleTable.FieldAllowDelete]);
            this.SortCode = BusinessLogic.ConvertToInt(dataReader[PiModuleTable.FieldSortCode]);
            this.DeleteMark = BusinessLogic.ConvertToInt(dataReader[PiModuleTable.FieldDeleteMark]);
            this.Enabled = BusinessLogic.ConvertToInt(dataReader[PiModuleTable.FieldEnabled]);
            this.Description = BusinessLogic.ConvertToString(dataReader[PiModuleTable.FieldDescription]);
            this.CreateOn = BusinessLogic.ConvertToDateTime(dataReader[PiModuleTable.FieldCreateOn]);
            this.CreateUserId = BusinessLogic.ConvertToString(dataReader[PiModuleTable.FieldCreateUserId]);
            this.CreateBy = BusinessLogic.ConvertToString(dataReader[PiModuleTable.FieldCreateBy]);
            this.ModifiedOn = BusinessLogic.ConvertToDateTime(dataReader[PiModuleTable.FieldModifiedOn]);
            this.ModifyUserId = BusinessLogic.ConvertToString(dataReader[PiModuleTable.FieldModifyUserId]);
            this.ModifiedBy = BusinessLogic.ConvertToString(dataReader[PiModuleTable.FieldModifiedBy]);
            this.Enabled    = this.Enabled  == null ? 0 : this.Enabled;
            this.IsPublic   = this.IsPublic == null ? 0 : this.IsPublic;
            this.IsMenu     = this.IsMenu   == null ? 0 : this.IsMenu;
            this.Expand     = this.Expand   == null ? 0 : this.Expand;
            return this;
        }
    }
}
